<template>
  <div class="login-content">
    <h3>后台管理系统</h3>
    <el-tabs
      type="border-card"
      class="login-pane"
      stretch
      @tab-click="changeTagClick"
    >
      <el-tab-pane>
        <template #label>
          <span class="titile">
            <el-icon><user /></el-icon>账号登录
          </span>
        </template>
        <login-user ref="loginUserRef" />
      </el-tab-pane>

      <el-tab-pane>
        <template #label>
          <span class="titile">
            <el-icon><iphone /></el-icon>手机登录
          </span>
        </template>
        <login-iphone />
      </el-tab-pane>
    </el-tabs>

    <div class="register-content">
      <el-checkbox label="记住密码"></el-checkbox>
      <el-link type="primary">注册账号</el-link>
    </div>

    <el-button type="primary" class="login-btn" @click="login">登录</el-button>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";
import LoginUser from "./login-user.vue";
import LoginIphone from "./login-iphone.vue";

export default defineComponent({
  components: {
    LoginUser,
    LoginIphone
  },
  setup() {
    const isUserLogin = ref(true);
    const loginUserRef = ref<InstanceType<typeof LoginUser>>();
    const changeTagClick = () => {
      console.log("changeTagClick");
    };
    const login = () => {
      loginUserRef.value?.loginStart();
    };
    return { isUserLogin, changeTagClick, login, loginUserRef };
  }
});
</script>

<style scoped>
.login-content {
  display: flex;
  /* justify-items: center; */
  align-items: center;
  flex-direction: column;
}
.login-pane {
  margin-top: 10px;
  width: 400px;
}
.el-icon {
  margin-right: 3px;
}
.titile {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-btn {
  width: 100%;
}

.register-content {
  display: flex;
  justify-content: space-between;
  width: 100%;
}
</style>
